package com.health.listener;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class Listener5 {

    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue("队列1"),
                    exchange = @Exchange(value = "交换机2",type = ExchangeTypes.TOPIC), key = {"product.*"}
            ))
    public void show1(String msg){
        System.out.println("通配符模式-队列1，消费信息："+msg);
    }

    @RabbitListener(
            bindings = @QueueBinding(value = @Queue("队列2"),
                    exchange = @Exchange(value = "交换机2",type = ExchangeTypes.TOPIC),key = "merchant.*"))
    public void show2(String msg){
        System.out.println("通配符模式-队列2，消费信息："+msg);
    }

}
